#ifndef FTPSERVER_H
#define FTPSERVER_H

#include <QTcpServer>
#include "ftpsession.h"
#include "serverconfig.h"

class FtpServer : public QTcpServer
{
    Q_OBJECT
public:
    explicit FtpServer(QObject *parent = nullptr);
    ~FtpServer();

    void setConfig(const ServerConfig& config);

    bool start();
    void stop();

private slots:
    void onAcceptError(QAbstractSocket::SocketError error);

private:
    void incomingConnection(qintptr handle) override;

private:
    ServerConfig m_serverConfig;
    QList<FtpSession*> m_sessions;
};

#endif // FTPSERVER_H
